<!DOCTYPE html>

<html xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">


<h:head>

	<style type="text/css">
.content {
	position: relative;
	width: 100%;
	margin: 0 auto;
}

.ui-layout,.ui-layout-doc,.ui-layout-unit,.ui-layout-wrap,.ui-layout-bd,.ui-layout-hd
	{
	border: none;
}

.companyHeaderGrid tr,.companyHeaderGrid td {
	border: none;
}

.delete-btn,.ui-widget-content .delete-btn {
	-moz-box-shadow: inset 0px 1px 0px 0px #f5978e;
	-webkit-box-shadow: inset 0px 1px 0px 0px #f5978e;
	box-shadow: inset 0px 1px 0px 0px #f5978e;
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f24537
		), color-stop(1, #c62d1f));
	background: -moz-linear-gradient(top, #f24537 5%, #c62d1f 100%);
	background: -webkit-linear-gradient(top, #f24537 5%, #c62d1f 100%);
	background: -o-linear-gradient(top, #f24537 5%, #c62d1f 100%);
	background: -ms-linear-gradient(top, #f24537 5%, #c62d1f 100%);
	background: linear-gradient(to bottom, #f24537 5%, #c62d1f 100%);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f24537',
		endColorstr='#c62d1f', GradientType=0);
	background-color: #f24537;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
	border: 1px solid #d02718;
	display: inline-block;
	cursor: pointer;
	color: #ffffff;
	font-family: arial;
	font-size: 15px;
	font-weight: bold;
	text-decoration: none;
	text-shadow: 0px 1px 0px #810e05;
}

.delete-btn:hover {
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #c62d1f
		), color-stop(1, #f24537));
	background: -moz-linear-gradient(top, #c62d1f 5%, #f24537 100%);
	background: -webkit-linear-gradient(top, #c62d1f 5%, #f24537 100%);
	background: -o-linear-gradient(top, #c62d1f 5%, #f24537 100%);
	background: -ms-linear-gradient(top, #c62d1f 5%, #f24537 100%);
	background: linear-gradient(to bottom, #c62d1f 5%, #f24537 100%);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#c62d1f',
		endColorstr='#f24537', GradientType=0);
	background-color: #c62d1f;
}

.delete-btn:active {
	position: relative;
	top: 1px;
}
</style>

</h:head>

<h:body>
	<img class="content" src="#{resource['images/top.jpg']}"
		alt="immagine top"></img>

	<!-- Importo il css per la customizzazione della pagina -->
	<h:outputStylesheet name="/css/custom.css" />
	
	
	<f:view contentType="text/html">
		<f:event type="preRenderView"
			listener="#{alloggioBean.obtainDisponibilitaForAlloggioSel}" />
	</f:view>

	<p:growl id="growl" for="growl-message" showDetail="true" sticky="true" />

	<p:layout fullPage="false" style=" max-width: 90%; height: 1000px">

		<p:layoutUnit position="north"
			style="min-height:100px; font-size: 13pt">
			<p:toolbar>
				<p:toolbarGroup align="right">
					<h:form>
						<p:commandButton id="logoutButton" value="Logout"
							icon="ui-icon-play" action="#{logoutBean.logout()}" />
					</h:form>
				</p:toolbarGroup>
			</p:toolbar>
		</p:layoutUnit>


		<!-- START - ZONA SX DELLA PAGINA -->
		<p:layoutUnit position="west" collapsible="true" size="22%" gutter="0">

			<!-- Inserisco dal file left_menu (della cartella corrente) il menu con i comandi -->
			<ui:insert name="left-menu">
				<div style="padding: 0px 0px 0px 0px">
					<ui:include src="left_menu.xhtml" />
				</div>
			</ui:insert>

		</p:layoutUnit>
		<!-- STOP - ZONA SX DELLA PAGINA -->

		<!-- START - Dettagli dell'alloggio -->
		<p:layoutUnit position="center"
			style="padding-left: 10px;margin-bottom: 0px" size="100%">

			<p:panelGrid columns="2" id="alloggio-data-panel"
				style="min-width: 100%; margin: 0 auto; font-size: 12pt"
				styleClass="companyHeaderGrid">



				<f:facet name="header">
					<p:outputLabel style="font-size: 15pt">Dati dell'alloggio</p:outputLabel>
					<h:form>
						<p:commandButton value="Elimina Alloggio" type="button"
							styleClass="delete-btn" onclick="PF('delete_dialog').show()" />
						<p:commandButton value="Modifica Alloggio" icon="ui-icon-pencil"
							action="edit_alloggio" ajax="false" />
					</h:form>


					<!-- Dialog di eliminazione -->
					<h:form id="del_dialog">

						<p:growl for="delete_alloggio_growl" autoUpdate="true" life="2000"
							showDetail="true" />
						<p:dialog header="Confermi l'eliminazione del'alloggio corrente?"
							widgetVar="delete_dialog" resizable="false" position="center"
							height="150px" width="350px">

							<p:outputLabel style="font-size: 12pt; color: #AA0000">
										Attenzione! Se l'alloggio viene eliminato, le disponibilità
										verranno eliminate definitivamente dal database
										</p:outputLabel>


							<f:facet name="footer">
								<h:form>
									<p:commandButton value="Si" styleClass="delete-btn"
										oncomplete="PF('delete_dialog').hide();" update=":del_dialog"
										action="#{alloggioBean.deleteAlloggio}" />
									<p:commandButton value="No" style="width: 70px; height: 35px"
										oncomplete="PF('delete_dialog').hide();" />
								</h:form>
							</f:facet>
						</p:dialog>
						<!-- FINE - Dialog di eliminazione -->
					</h:form>
				</f:facet>

				<h:outputText value="Nome Alloggio: " />
				<p:outputLabel
					value="#{alloggioBean.alloggioSelezionato.descrizione}" />


				<h:outputText value="Citta: " />
				<p:outputLabel
					value="#{alloggioBean.alloggioSelezionato.citta.name}" />
				<f:facet name="footer">
					<h:form>
						<p:commandButton value="Inserisci Disponibilita"
							icon="ui-icon-pencil" action="edit_diponibilita" ajax="false" />
					</h:form>
				</f:facet>

			</p:panelGrid>

			<p:panelGrid columns="2" id="disp_alloggio-panel"
				style="min-width: 100%; margin: 0 auto; font-size: 12pt"
				styleClass="companyHeaderGrid">


				<p:dataTable value="#{alloggioBean.disponibilitaAlloggioSel}"
					var="disp" id="disp_alloggi_table"
					emptyMessage="Non ci sono camere disponibili per #{pacchettoBean.pacchettoSelezionato.alloggi.descrizione}"
					rows="20000" rowKey="#{disp.idDisponibilita}" scrollable="true"
					liveScroll="true" scrollHeight="350">

					<f:facet name="header"> Disponibilita per #{pacchettoBean.pacchettoSelezionato.alloggi.descrizione} </f:facet>

					<p:column>
						<f:facet name="header"> Tipo Camera  </f:facet>
									#{disp.tipoCamera}
						</p:column>


					<p:column>
						<f:facet name="header"> Data  </f:facet>
									#{disp.dataAsString}
						</p:column>

					<p:column>
						<f:facet name="header"> Prezzo Camera  </f:facet>
									#{disp.prezzo}
						</p:column>

					<p:column>
						<f:facet name="header"> Numero Camere  </f:facet>
									#{disp.numerocamere}
						</p:column>

				</p:dataTable>

			</p:panelGrid>
		</p:layoutUnit>
		<!-- STOP - Dettagli dell'alloggio -->








	</p:layout>
	<img class="content" src="#{resource['images/bottom.jpg']}"
		alt="immagine top"></img>

</h:body>
</html>